//
//  ExtractedFunctionsBootcamp_21.swift
//  SwiftUiExercise
//
//  Created by 徐鹏 on 2023/6/30.
//

import SwiftUI

struct ExtractedFunctionsBootcamp_21: View {
    
    @State var backgroundColor: Color = Color.pink
    
    var body: some View {
        ZStack{
            
            backgroundColor.edgesIgnoringSafeArea(.all)
            
            contentLayer
            
           

        }
    }
    
    var contentLayer: some View{
        VStack{
            
            Text("Title")
                .font(.largeTitle)
            
            Button {
                
                buttonPressed()
                
            } label: {
                Text("PRESE ME")
                    .font(.headline)
                    .foregroundColor(.white)
                    .padding()
                    .background(Color.black)
                    .cornerRadius(10)
            }
        }
    }
    
    
    func buttonPressed(){
        backgroundColor = .gray
    }
}

struct ExtractedFunctionsBootcamp_21_Previews: PreviewProvider {
    static var previews: some View {
        ExtractedFunctionsBootcamp_21()
    }
}
